package com.jxd.hbase.utils;

import com.jxd.mapper.ShipInformationMapper;
import com.jxd.model.ShipInformation;
import com.jxd.service.ShipInformationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UpdateSendDeviceName {
    @Autowired
    private  ShipInformationService shipInformationService;
    public  String  updateSendDeviceName(String shipid ,String SendDevice){
        ShipInformation shipInformation =shipInformationService.selectAllByXtbh(shipid);
        //判断型号信息为055(大) 或者052d（小）
        if (shipInformation.getXtmodelname().toString().equals("055")){
            if (SendDevice.matches(".*F1.*")) {
                SendDevice = "11";
            }else if (SendDevice.matches(".*F2.*")) {
                SendDevice = "12";
            }else if (SendDevice.matches(".*F3.*")) {
                SendDevice = "13";
            }else if (SendDevice.matches(".*F4.*")) {
                SendDevice = "14";
            }else if (SendDevice.matches(".*F5.*")) {
                SendDevice = "15";
            }else if (SendDevice.matches(".*F6.*")) {
                SendDevice = "16";
            }else if (SendDevice.matches(".*F7.*")) {
                SendDevice = "17";
            }else if (SendDevice.matches(".*F8.*")) {
                SendDevice = "18";
            }else if (SendDevice.matches(".*.200.9")||SendDevice.matches(".*F9.*")) {
                SendDevice = "21";
            }else if (SendDevice.matches(".*.200.10")||SendDevice.matches(".*F10.*")) {
                SendDevice = "22";
            }else if (SendDevice.matches(".*.200.11")||SendDevice.matches(".*F11.*")) {
                SendDevice = "23";
            }else if (SendDevice.matches(".*.200.12")||SendDevice.matches(".*F12.*")) {
                SendDevice = "24";
            }else if (SendDevice.matches(".*.200.13")||SendDevice.matches(".*F13.*")) {
                SendDevice = "25";
            }else if (SendDevice.matches(".*.200.14")||SendDevice.matches(".*F14.*")) {
                SendDevice = "26";
            }
        }else {
            if (SendDevice.matches(".*F1.*")) {
                SendDevice = "11";
            }else if (SendDevice.matches(".*F2.*")) {
                SendDevice = "12";
            }else if (SendDevice.matches(".*F3.*")) {
                SendDevice = "13";
            }else if (SendDevice.matches(".*F4.*")) {
                SendDevice = "14";
            }else if (SendDevice.matches(".*F5.*")) {
                SendDevice = "21";
            }else if (SendDevice.matches(".*F6.*")) {
                SendDevice = "22";
            }else if (SendDevice.matches(".*F7.*")) {
                SendDevice = "23";
            }else if (SendDevice.matches(".*F8.*")) {
                SendDevice = "24";
            }
        }
        return SendDevice;
    }
}
